
package fibonacci;

/**
 *
 * @author Gustavo Canul
 */
public class Fibonacci {

    private long numero;//Atributo n
    
   public Fibonacci(){
       
   }//fin fibonacci

    /**
     * @return the n
     */
    public long getN() {
        return numero;
    }

    /**
     * @param n the n to set
     */
    public void setN(long n) {
        this.numero = n;
    }
    
    public long CalculoFibo(long n){
        if (n==0)
            return 0;
        else if(n==1)
            return 1;
        else
            return CalculoFibo(n-1)+CalculoFibo(n-2);
    }//fin Calculo del Fibonacci
    
    public String ShowFibo(long n){
        this.numero=n;
        String s="";
        Fibonacci fibi = new Fibonacci();
       for (int i=0;i<=n;i++){
           s+="\n"+fibi.CalculoFibo(i);
       }
          
       return s;
    }//fin de ShowFibonacci
   
}//Fin de clase Fibonacci
